package com.auxgroup.hr.front.dao.repository;

import com.auxgroup.hr.front.dao.domain.PsRsHireIdTbl;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

/**
 * Created by nitongqian on 2019/2/11.
 */
@Repository
public interface PsRsHireIdTblRepository extends JpaRepository<PsRsHireIdTbl,String> {

    @Query("SELECT MAX(rsHireId) FROM PsRsHireIdTbl")
    String getMaxHireId();

    @Modifying
    @Transactional
    @Query("UPDATE PsRsHireIdTbl SET rsHireId = rsHireId + 1")
    void increase();
}
